package com.fhz.kotlinstest.paging

import androidx.recyclerview.widget.DiffUtil

class MyCallback(var oldList: List<Student>, var newlist: List<Student>) : DiffUtil.Callback() {
    override fun getOldListSize(): Int {
      return oldList.size
    }

    override fun getNewListSize(): Int {
        return newlist.size
    }

    override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
        return oldList[oldItemPosition] == newlist[newItemPosition]
    }

    override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {

        if (oldList[oldItemPosition].title == newlist[newItemPosition].title){
            return true
        }
       return false
    }
}